package com.weavernorth.modelInterFace.utils;

import org.apache.log4j.Logger;
import weaver.conn.ConnStatement;

/**
 * @Author: bruseewang
 * @Package: com.weavernorth.modelInterFace.utils
 * @date: 2020/7/6 11:34
 * @description:
 */
public class tableUtils {
    public static String getColumnType(ConnStatement statement, String filedName, Logger log){
        String str=null;
        try{
            int columnCount = statement.getColumnCount();
            log.info("列的总数为："+columnCount);
            for (int i=1;i<=columnCount;i++){
                String columnName= statement.getColumnName(i).toUpperCase();
//                log.info("第"+i+"行的列明为："+columnName);
                String columnType=statement.getColumnTypeName(i);
//                log.info("第"+i+"行的列类型为："+columnType);
                if (filedName.equals(columnName)){
                    str=columnType;
                    break;
                }
            }
        }catch (Exception ex){
            ex.printStackTrace();
            str="1";
        }
        return str;
    }
}
